//
//  YZPigGroupDocInCell.m
//  VET
//
//  Created by YZ on 2018/7/21.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZPigGroupDocInCell.h"

@interface YZPigGroupDocInCell ()

@property (nonatomic, strong) UILabel *dateLb;

@property (nonatomic, strong) UILabel *inNumLb;

@property (nonatomic, strong) UILabel *numLb;

@property (nonatomic, strong) UIImageView *transferImgView;

@end

@implementation YZPigGroupDocInCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.layer.masksToBounds = YES;
        [self.contentView addSubview:self.dateLb];
        [self.contentView addSubview:self.inNumLb];
        [self.contentView addSubview:self.numLb];
        [self.contentView addSubview:self.transferImgView];
        
        [self makeContraints];
    }
    return self;
}

- (void)makeContraints
{
    [self.dateLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kCurrentDeviceNum(20));
        make.top.mas_equalTo(kCurrentDeviceNum(10));
        make.width.mas_lessThanOrEqualTo(150);
    }];
    
    [self.inNumLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.dateLb);
        make.top.equalTo(self.dateLb.mas_bottom);
        make.width.mas_lessThanOrEqualTo(150);
    }];
    
    [self.numLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.inNumLb);
        make.left.equalTo(self.inNumLb.mas_right);
        make.width.mas_lessThanOrEqualTo(150);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-kCurrentDeviceNum(10));
    }];
    
    [self.transferImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(kCurrentDeviceNum(7), kCurrentDeviceNum(12)));
        make.right.equalTo(self.contentView.mas_right).offset(-kCurrentDeviceNum(20));
    }];
}
#pragma mark -- settters&&getters

- (UILabel *)dateLb
{
    if (!_dateLb) {
        _dateLb =  [UILabel new];
        _dateLb.textAlignment = NSTextAlignmentLeft;
        _dateLb.font = kCurrentDeviceFont(14);
        _dateLb.textColor = kColorWithHex(0x434343);
    }
    return _dateLb;
}

- (UILabel *)inNumLb
{
    if (!_inNumLb) {
        _inNumLb =  [UILabel new];
        _inNumLb.textAlignment = NSTextAlignmentLeft;
        _inNumLb.font = kCurrentDeviceFont(14);
        _inNumLb.textColor = kColorWithHex(0x9B9B9B);
        _inNumLb.text = @"转入头数: ";
    }
    return _inNumLb;
}

- (UILabel *)numLb
{
    if (!_numLb) {
        _numLb =  [UILabel new];
        _numLb.textAlignment = NSTextAlignmentLeft;
        _numLb.font = kCurrentDeviceFont(14);
        _numLb.textColor = kColorWithHex(0x9B9B9B);
    }
    return _numLb;
}

- (UIImageView *)transferImgView
{
    if (!_transferImgView) {
        _transferImgView = [UIImageView new];
        _transferImgView.image = [UIImage imageNamed:@"ico_right"];
    }
    return _transferImgView;
}

- (void)setModel:(YZPigGroupDocInModel *)model
{
    _model = model;
    self.dateLb.text = model.transferDate;
    self.numLb.text = model.inNum;
}
@end
